﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xant.Utils;

namespace TestApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            PersonManager manager = CreateInstance();

            Console.WriteLine("Original Persons");
            foreach(Person p in manager.Persons)
                Console.WriteLine(p.ToString());
            Console.WriteLine();


            Console.WriteLine("Copy of \"De Niro\", no flavor defined:");
            Console.WriteLine(ObjectCloner.Clone(manager.Persons[1]));
            Console.WriteLine();

            Console.WriteLine("Copy of \"De Niro\", \"Friends\" flavor defined:");
            Console.WriteLine(ObjectCloner.Clone(manager.Persons[1], true, "Friends"));
            Console.WriteLine();

            Console.ReadLine();
        }

        static PersonManager CreateInstance()
        {
            PersonManager manager = new PersonManager();
            
            manager.Persons.Add(new Person() { Firstname = "Kevin", Lastname = "Spacey", Manager = manager });
            manager.Persons.Add(new Person() { Firstname = "Robert", Lastname = "De Niro", Manager = manager });
            manager.Persons.Add(new Person() { Firstname = "Alfredo", Lastname = "Pacino", Manager = manager });
            manager.Persons.Add(new Person() { Firstname = "Anthony", Lastname = "Hopkins", Manager = manager });

            manager.Persons[0].Friends.Add(manager.Persons[3]);
            manager.Persons[3].Friends.Add(manager.Persons[0]);

            manager.Persons[1].Friends.Add(manager.Persons[2]);
            manager.Persons[2].Friends.Add(manager.Persons[1]);

            manager.Persons[1].Friends.Add(manager.Persons[0]);
            manager.Persons[0].Friends.Add(manager.Persons[1]);

            return manager;
        }
    }
}
